<?php
namespace app\api\controller;
use app\api\model\AnnouncementModel;
class About extends BaseController
{
	public function __construct()
    {
        parent::__construct();
        $this->About = new AnnouncementModel();
    }
	public function AjaxReturn($code,$msg,$data=array())
	{

		$returnData=array(
			"code"=>$code
		);
		if($msg)
		{
		  $returnData["message"]=$msg;
		}
		if(!empty($data))
		{
			$returnData["data"]=$data;
		}
		exit(json_encode($returnData));
	}
	//公告显示
	//传值:createtime(时间)content(内容)id(公告ID)
	public function index (){
		$list=$this->About->index();
      	foreach($list as $key=>$val){
			$list[$key]['createtime']=date('Y-m-d H:i',$list[$key]['createtime']);
		}
		return $this->AjaxReturn("1",'操作成功',$list);
	}
	//公告详情查看
	//接值:id(公告ID)
	//传值:createtime(时间)content(内容)id(公告ID)
	public function indexAll (){
		$id=input('id');
		$list=$this->About->getOneId($id);
		$list['createtime']=date('Y-m-d H:i',$list['createtime']);
		return $this->AjaxReturn("1",'操作成功',$list);
	}
	//关于我们显示
	//传值:createtime(时间)content(关于我们内容)id(公告ID)
	public function aboutindex (){
		$list=$this->About->aboutindex();
		$list['createtime']=date('Y-m-d H:i',$list['createtime']);
		return $this->AjaxReturn("1",'操作成功',$list);
	}
}